/**
 * @param {string[]} names
 * @param {number[]} heights
 * @return {string[]}
 */
var sortPeople = function (names, heights) {
  let maxValue = 0, maxIndex = -1
  for (let i = 0; i < heights.length - 1; i++) {
    maxValue = heights[i]
    maxIndex = i
    for (let j = i + 1; j < heights.length; j++) {
      if (heights[j] > maxValue) {
        maxIndex = j
        maxValue = heights[j]
      }
    }

    [heights[i], heights[maxIndex]] = [heights[maxIndex], heights[i]];
    [names[i], names[maxIndex]] = [names[maxIndex], names[i]]
  }

  return names
};

sortPeople(["IEO", "Sgizfdfrims", "QTASHKQ", "Vk", "RPJOFYZUBFSIYp", "EPCFFt", "VOYGWWNCf", "WSpmqvb"],
  [17233, 32521, 14087, 42738, 46669, 65662, 43204, 8224])